package cn.javase.io_model.bio._01_同步阻塞案例;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        try(
            ServerSocket server = new ServerSocket(9999);
            Socket socket = server.accept();
            BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        ) {
            String msg;
            while((msg = in.readLine()) != null) {
                System.out.println(msg);
            }
        }
    }
}
